﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Services
{
    public class UserServer : IUser
    {
        public DB_User db = null;
        public UserServer()
        {
            db = new DB_User();
        }

        public bool Insert(User user)
        {
            if (user == null)
            {
                return false;
            }
            return db.InsertUser(user);
        }

        public bool Update(User user)
        {
            if (user == null)
            {
                return false;
            }
            return db.UpdateUser(user);
        }

        public bool Delete(string id)
        {
            return db.DeleteUser(id);
        }

        public User GetUserById(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return null;
            }
            return db.GetUserById(id);
        }

        public List<User> GetAllUser()
        {
            return db.GetAllUser();
        }
    }
}
